{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "9651c25a-42b7-4208-8445-f5546f907a45",
   "metadata": {},
   "source": [
    "# 第二节、数据查看"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "8b77b647-3734-43f7-b22e-559255231273",
   "metadata": {},
   "source": [
    "查看DataFrame的常用属性和DataFrame的概览和统计信息。"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "9eaa9ed5-3736-4016-8a7f-1eeeeb759d49",
   "metadata": {},
   "source": [
    "## （1）查看属性"
   ]
  },
  {
   "cell_type": "code",
   "id": "58a55e01-f831-4f20-91dd-002283169463",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-06-20T05:46:23.724703Z",
     "start_time": "2025-06-20T05:46:23.718824Z"
    }
   },
   "source": [
    "import numpy as np\n",
    "import pandas as pd"
   ],
   "outputs": [],
   "execution_count": 1
  },
  {
   "cell_type": "code",
   "id": "d3af6c13-3939-449d-abd8-a9baf3143738",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-06-20T05:46:23.757197Z",
     "start_time": "2025-06-20T05:46:23.737454Z"
    }
   },
   "source": [
    "# 创建 shape(150, 3) 的二维标签数组结构 DataFrame\n",
    "df = pd.DataFrame(\n",
    "    data=np.random.randint(0, 150, size=(150, 3)),\n",
    "    columns=['python', 'math', 'english']\n",
    ")\n",
    "df"
   ],
   "outputs": [
    {
     "data": {
      "text/plain": [
       "     python  math  english\n",
       "0        32     6       67\n",
       "1        60    70       86\n",
       "2       144    50      121\n",
       "3       123    27       49\n",
       "4        49    13      144\n",
       "..      ...   ...      ...\n",
       "145     119    68       22\n",
       "146      11     5       43\n",
       "147     111     9      104\n",
       "148     149    56      116\n",
       "149     104    60      118\n",
       "\n",
       "[150 rows x 3 columns]"
      ],
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>python</th>\n",
       "      <th>math</th>\n",
       "      <th>english</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>32</td>\n",
       "      <td>6</td>\n",
       "      <td>67</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>60</td>\n",
       "      <td>70</td>\n",
       "      <td>86</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>144</td>\n",
       "      <td>50</td>\n",
       "      <td>121</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>123</td>\n",
       "      <td>27</td>\n",
       "      <td>49</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>49</td>\n",
       "      <td>13</td>\n",
       "      <td>144</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>145</th>\n",
       "      <td>119</td>\n",
       "      <td>68</td>\n",
       "      <td>22</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>146</th>\n",
       "      <td>11</td>\n",
       "      <td>5</td>\n",
       "      <td>43</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>147</th>\n",
       "      <td>111</td>\n",
       "      <td>9</td>\n",
       "      <td>104</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>148</th>\n",
       "      <td>149</td>\n",
       "      <td>56</td>\n",
       "      <td>116</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>149</th>\n",
       "      <td>104</td>\n",
       "      <td>60</td>\n",
       "      <td>118</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>150 rows × 3 columns</p>\n",
       "</div>"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 2
  },
  {
   "cell_type": "code",
   "id": "b90c2ad9-5771-4daa-9389-02f40795255d",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-06-20T05:46:23.778696Z",
     "start_time": "2025-06-20T05:46:23.770044Z"
    }
   },
   "source": [
    "# 查看属性、概览和统计信息\n",
    "df.head()   # 默认显示5个"
   ],
   "outputs": [
    {
     "data": {
      "text/plain": [
       "   python  math  english\n",
       "0      32     6       67\n",
       "1      60    70       86\n",
       "2     144    50      121\n",
       "3     123    27       49\n",
       "4      49    13      144"
      ],
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>python</th>\n",
       "      <th>math</th>\n",
       "      <th>english</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>32</td>\n",
       "      <td>6</td>\n",
       "      <td>67</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>60</td>\n",
       "      <td>70</td>\n",
       "      <td>86</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>144</td>\n",
       "      <td>50</td>\n",
       "      <td>121</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>123</td>\n",
       "      <td>27</td>\n",
       "      <td>49</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>49</td>\n",
       "      <td>13</td>\n",
       "      <td>144</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 3
  },
  {
   "cell_type": "code",
   "id": "28aa663b-294e-4b43-93d1-0f2360a1d696",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-06-20T05:46:23.809495Z",
     "start_time": "2025-06-20T05:46:23.801055Z"
    }
   },
   "source": [
    "df.head(10)  # 指定个数字就查询多少行"
   ],
   "outputs": [
    {
     "data": {
      "text/plain": [
       "   python  math  english\n",
       "0      32     6       67\n",
       "1      60    70       86\n",
       "2     144    50      121\n",
       "3     123    27       49\n",
       "4      49    13      144\n",
       "5      27    87       65\n",
       "6     138    37      135\n",
       "7      64    21      120\n",
       "8     115   116       47\n",
       "9      25    77        7"
      ],
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>python</th>\n",
       "      <th>math</th>\n",
       "      <th>english</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>32</td>\n",
       "      <td>6</td>\n",
       "      <td>67</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>60</td>\n",
       "      <td>70</td>\n",
       "      <td>86</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>144</td>\n",
       "      <td>50</td>\n",
       "      <td>121</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>123</td>\n",
       "      <td>27</td>\n",
       "      <td>49</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>49</td>\n",
       "      <td>13</td>\n",
       "      <td>144</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>27</td>\n",
       "      <td>87</td>\n",
       "      <td>65</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>138</td>\n",
       "      <td>37</td>\n",
       "      <td>135</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>64</td>\n",
       "      <td>21</td>\n",
       "      <td>120</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>115</td>\n",
       "      <td>116</td>\n",
       "      <td>47</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>25</td>\n",
       "      <td>77</td>\n",
       "      <td>7</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 4
  },
  {
   "cell_type": "code",
   "id": "0660a4e1-0681-4005-ab0d-a4c27f5645a2",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-06-20T05:46:23.844871Z",
     "start_time": "2025-06-20T05:46:23.833497Z"
    }
   },
   "source": [
    "df.tail()  # 从尾部开始查，和head同理"
   ],
   "outputs": [
    {
     "data": {
      "text/plain": [
       "     python  math  english\n",
       "145     119    68       22\n",
       "146      11     5       43\n",
       "147     111     9      104\n",
       "148     149    56      116\n",
       "149     104    60      118"
      ],
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>python</th>\n",
       "      <th>math</th>\n",
       "      <th>english</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>145</th>\n",
       "      <td>119</td>\n",
       "      <td>68</td>\n",
       "      <td>22</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>146</th>\n",
       "      <td>11</td>\n",
       "      <td>5</td>\n",
       "      <td>43</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>147</th>\n",
       "      <td>111</td>\n",
       "      <td>9</td>\n",
       "      <td>104</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>148</th>\n",
       "      <td>149</td>\n",
       "      <td>56</td>\n",
       "      <td>116</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>149</th>\n",
       "      <td>104</td>\n",
       "      <td>60</td>\n",
       "      <td>118</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 5
  },
  {
   "cell_type": "code",
   "id": "e70f9035-c28a-4725-b9a9-a2185edac812",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-06-20T05:46:23.901497Z",
     "start_time": "2025-06-20T05:46:23.893719Z"
    }
   },
   "source": [
    "df.shape   # 查看形状，行数和列数"
   ],
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(150, 3)"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 6
  },
  {
   "cell_type": "code",
   "id": "61f2c291-3e17-4f9f-aaf8-11607379c9d5",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-06-20T05:46:23.951825Z",
     "start_time": "2025-06-20T05:46:23.941512Z"
    }
   },
   "source": [
    "df.dtypes  # 查看数据类型，一定注意最后有个s"
   ],
   "outputs": [
    {
     "data": {
      "text/plain": [
       "python     int32\n",
       "math       int32\n",
       "english    int32\n",
       "dtype: object"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 7
  },
  {
   "cell_type": "code",
   "id": "3062002d-8b93-4459-8ce5-32b877d14ca1",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-06-20T05:46:24.010314Z",
     "start_time": "2025-06-20T05:46:24.000836Z"
    }
   },
   "source": [
    "df.index   # 行索引，返回的是一个行索引对象"
   ],
   "outputs": [
    {
     "data": {
      "text/plain": [
       "RangeIndex(start=0, stop=150, step=1)"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 8
  },
  {
   "cell_type": "code",
   "id": "ee3f2d9e-2353-4c13-a4b6-45a8a8ea30cd",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-06-20T05:46:24.088590Z",
     "start_time": "2025-06-20T05:46:24.078489Z"
    }
   },
   "source": [
    "df.columns  # 列索引"
   ],
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Index(['python', 'math', 'english'], dtype='object')"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 9
  },
  {
   "cell_type": "code",
   "id": "382da412-fe52-4f0a-be73-dd22a3f9947c",
   "metadata": {
    "scrolled": true,
    "ExecuteTime": {
     "end_time": "2025-06-20T05:46:24.152074Z",
     "start_time": "2025-06-20T05:46:24.138606Z"
    }
   },
   "source": [
    "df.values   # DataFrame里面存放的数据，返回的是一个ndarray"
   ],
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 32,   6,  67],\n",
       "       [ 60,  70,  86],\n",
       "       [144,  50, 121],\n",
       "       [123,  27,  49],\n",
       "       [ 49,  13, 144],\n",
       "       [ 27,  87,  65],\n",
       "       [138,  37, 135],\n",
       "       [ 64,  21, 120],\n",
       "       [115, 116,  47],\n",
       "       [ 25,  77,   7],\n",
       "       [ 66,  51,  45],\n",
       "       [ 49,  87,  27],\n",
       "       [ 12, 119,  88],\n",
       "       [  9, 103,  39],\n",
       "       [ 95,  21,  56],\n",
       "       [ 48,  20,   0],\n",
       "       [125,  48,  73],\n",
       "       [ 27, 148, 105],\n",
       "       [127, 133,  14],\n",
       "       [  5, 136,  61],\n",
       "       [ 34,  45,  72],\n",
       "       [120, 142,  74],\n",
       "       [  2,  86, 114],\n",
       "       [107,  26,  24],\n",
       "       [ 16, 147,  92],\n",
       "       [ 30, 148, 106],\n",
       "       [ 89,  38, 131],\n",
       "       [ 53,  15,  82],\n",
       "       [146, 126, 109],\n",
       "       [ 52, 131, 149],\n",
       "       [117, 100,  60],\n",
       "       [111,   1,  89],\n",
       "       [ 51, 133, 139],\n",
       "       [ 23,  60,  95],\n",
       "       [ 64, 121,  95],\n",
       "       [ 97, 125,  79],\n",
       "       [ 80,  17,  17],\n",
       "       [ 31,  12,  68],\n",
       "       [107, 122,  87],\n",
       "       [ 76,  62,  80],\n",
       "       [ 97,  53, 120],\n",
       "       [ 49,  14, 134],\n",
       "       [ 51,  20,  31],\n",
       "       [125,   1, 148],\n",
       "       [ 62,  62, 109],\n",
       "       [  8, 129, 130],\n",
       "       [  0, 120, 117],\n",
       "       [ 39, 121,  92],\n",
       "       [126,  24, 120],\n",
       "       [ 71,   8,  60],\n",
       "       [105,  52, 138],\n",
       "       [ 66,  50, 137],\n",
       "       [127, 114,   8],\n",
       "       [ 23,  66,  61],\n",
       "       [ 56,   1, 141],\n",
       "       [ 74,  60,  11],\n",
       "       [ 43, 101,  81],\n",
       "       [  4,  94, 105],\n",
       "       [124,  39, 138],\n",
       "       [  0,  57,  71],\n",
       "       [ 13,  65,  14],\n",
       "       [ 52, 104,  51],\n",
       "       [118, 125,  71],\n",
       "       [ 87,  89,  85],\n",
       "       [ 83,   0, 144],\n",
       "       [ 92, 148,  42],\n",
       "       [  2, 100, 130],\n",
       "       [ 32, 121,  71],\n",
       "       [ 69,  51,  44],\n",
       "       [ 53,  55, 118],\n",
       "       [141,  47,  30],\n",
       "       [126, 117, 141],\n",
       "       [ 91, 103,  42],\n",
       "       [ 16,  67,  44],\n",
       "       [ 38,  60,  92],\n",
       "       [ 19,  41,  84],\n",
       "       [ 12,  24,  63],\n",
       "       [131, 107, 141],\n",
       "       [ 17,  38, 148],\n",
       "       [110, 100,  55],\n",
       "       [ 57,  73,  54],\n",
       "       [ 34,  18,  32],\n",
       "       [ 94,  78,  30],\n",
       "       [ 73,  78,  49],\n",
       "       [140,  70,  81],\n",
       "       [134,  25, 111],\n",
       "       [ 28, 136,  48],\n",
       "       [106,  71,  59],\n",
       "       [ 61, 120,  24],\n",
       "       [ 42,   3,  94],\n",
       "       [  1,  35,  76],\n",
       "       [ 69, 136,  76],\n",
       "       [ 71,  55,  28],\n",
       "       [ 36, 123,  88],\n",
       "       [ 45, 116,  99],\n",
       "       [ 13,  62,  89],\n",
       "       [ 84, 104, 103],\n",
       "       [ 53, 108, 142],\n",
       "       [  0, 147,  35],\n",
       "       [ 95,  70, 101],\n",
       "       [ 48,  27,  89],\n",
       "       [ 57,  19,  68],\n",
       "       [ 64,  68,   4],\n",
       "       [ 32,  38,  61],\n",
       "       [127,  16,  12],\n",
       "       [ 53, 135,  81],\n",
       "       [100,  22, 105],\n",
       "       [ 80, 136, 137],\n",
       "       [110, 126,   3],\n",
       "       [ 79, 144,  25],\n",
       "       [ 24, 128,  44],\n",
       "       [ 81,  86,  26],\n",
       "       [149,  61,  98],\n",
       "       [127,  71, 121],\n",
       "       [121,  35, 147],\n",
       "       [137,  33, 120],\n",
       "       [ 58, 124, 103],\n",
       "       [ 21,  41,  38],\n",
       "       [ 74, 136, 129],\n",
       "       [ 41,  99,  82],\n",
       "       [148,  53,  57],\n",
       "       [ 68, 145,  64],\n",
       "       [  6,  92,  95],\n",
       "       [113,  60,  15],\n",
       "       [ 13,  16, 101],\n",
       "       [116,  80,  77],\n",
       "       [  4, 136, 135],\n",
       "       [141,  68, 143],\n",
       "       [ 98,  76, 115],\n",
       "       [ 89,  15,  27],\n",
       "       [ 33,  11,  94],\n",
       "       [ 70, 108, 136],\n",
       "       [ 92,  21,  71],\n",
       "       [142,  31,  83],\n",
       "       [ 22,  49, 114],\n",
       "       [ 72,  91,  93],\n",
       "       [ 95, 101,  63],\n",
       "       [ 71,  87,  44],\n",
       "       [128, 129, 144],\n",
       "       [ 19, 140, 102],\n",
       "       [ 46,  57, 130],\n",
       "       [  4, 118,  20],\n",
       "       [ 24, 133, 137],\n",
       "       [  9,  55, 133],\n",
       "       [ 38,  76,  78],\n",
       "       [119,  68,  22],\n",
       "       [ 11,   5,  43],\n",
       "       [111,   9, 104],\n",
       "       [149,  56, 116],\n",
       "       [104,  60, 118]], dtype=int32)"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 10
  },
  {
   "cell_type": "markdown",
   "id": "7b089af7-5382-4f12-8c66-f955c07d0308",
   "metadata": {},
   "source": [
    "## （2）查看概述与统计信息"
   ]
  },
  {
   "cell_type": "code",
   "id": "bad09934-2d3b-4933-8be8-7bd5271006b3",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-06-20T05:46:24.252721Z",
     "start_time": "2025-06-20T05:46:24.218977Z"
    }
   },
   "source": [
    "# 查看数值型列的汇总、统计、计数、平均值、标准差、最小值、四分位数、最大值\n",
    "df.describe()"
   ],
   "outputs": [
    {
     "data": {
      "text/plain": [
       "           python        math     english\n",
       "count  150.000000  150.000000  150.000000\n",
       "mean    68.480000   73.960000   81.726667\n",
       "std     43.493843   43.932358   40.673012\n",
       "min      0.000000    0.000000    0.000000\n",
       "25%     32.000000   38.000000   49.000000\n",
       "50%     65.000000   69.000000   82.500000\n",
       "75%    106.750000  116.750000  115.750000\n",
       "max    149.000000  148.000000  149.000000"
      ],
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>python</th>\n",
       "      <th>math</th>\n",
       "      <th>english</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>count</th>\n",
       "      <td>150.000000</td>\n",
       "      <td>150.000000</td>\n",
       "      <td>150.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mean</th>\n",
       "      <td>68.480000</td>\n",
       "      <td>73.960000</td>\n",
       "      <td>81.726667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>std</th>\n",
       "      <td>43.493843</td>\n",
       "      <td>43.932358</td>\n",
       "      <td>40.673012</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>min</th>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25%</th>\n",
       "      <td>32.000000</td>\n",
       "      <td>38.000000</td>\n",
       "      <td>49.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>50%</th>\n",
       "      <td>65.000000</td>\n",
       "      <td>69.000000</td>\n",
       "      <td>82.500000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>75%</th>\n",
       "      <td>106.750000</td>\n",
       "      <td>116.750000</td>\n",
       "      <td>115.750000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>max</th>\n",
       "      <td>149.000000</td>\n",
       "      <td>148.000000</td>\n",
       "      <td>149.000000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 11
  },
  {
   "cell_type": "code",
   "id": "2b4f9855-a97e-4b15-b96e-5c87a1897f43",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-06-20T05:46:24.355553Z",
     "start_time": "2025-06-20T05:46:24.333752Z"
    }
   },
   "source": [
    "# 查看列索引，数据类型，非空计数和内存信息\n",
    "df.info()"
   ],
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "RangeIndex: 150 entries, 0 to 149\n",
      "Data columns (total 3 columns):\n",
      " #   Column   Non-Null Count  Dtype\n",
      "---  ------   --------------  -----\n",
      " 0   python   150 non-null    int32\n",
      " 1   math     150 non-null    int32\n",
      " 2   english  150 non-null    int32\n",
      "dtypes: int32(3)\n",
      "memory usage: 1.9 KB\n"
     ]
    }
   ],
   "execution_count": 12
  },
  {
   "cell_type": "code",
   "id": "b7ba4011-61f9-4e95-8827-743acd7b10fb",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-06-20T05:46:24.459159Z",
     "start_time": "2025-06-20T05:46:24.455128Z"
    }
   },
   "source": [],
   "outputs": [],
   "execution_count": null
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.11"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
